package com.jlnk.retrofitdemo.service;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class RetrofitClient {
    private static final String BASE_URL_YUANXI = "https://www.yuanxiapi.cn/";
    private static final String BASE_URL_TEN = "https://tenapi.cn/";

    private static Retrofit yuanXiRetrofit = null;
    private static Retrofit tenRetrofit = null;

    public static Retrofit getYuanXiClient() {
        if (yuanXiRetrofit == null) {
            yuanXiRetrofit = new Retrofit.Builder()
                    .baseUrl(BASE_URL_YUANXI)
                    .addConverterFactory(GsonConverterFactory.create())
                    .build();
        }
        return yuanXiRetrofit;
    }

    public static Retrofit getTenClient() {
        if (tenRetrofit == null) {
            tenRetrofit = new Retrofit.Builder()
                    .baseUrl(BASE_URL_TEN)
                    .addConverterFactory(GsonConverterFactory.create())
                    .build();
        }
        return tenRetrofit;
    }
}